#include <stdio.h>
#include <string.h>

int main(int argc, const char *argv[])
{
	FILE *fp = fopen("./1.txt","r+");
	char buf[32]={0};
	char getbuf[32]={0};
	scanf("%s",buf);
	buf[strlen(buf)-1]=='\0';
	fputs(buf,fp);

	fseek(fp,0,SEEK_SET);
	fgets(getbuf,31,fp);

	fseek(fp,0,SEEK_SET);

	printf("%s\n",getbuf);

	char writebuf[32]="helloworld\n";
	char readbuf[32];
	printf("%d\n",strlen(writebuf));
	fwrite(writebuf,strlen(writebuf),1,fp);
	fwrite("fxy",3,1,fp);
	fseek(fp,0,SEEK_SET);
	fread(readbuf,32,1,fp);

	printf("%s\n",readbuf);

	return 0;
}
